home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.46 / stinglibpcq / source / cpos.p < prev    next >
Text File  |  1995-03-27  |  559b  |  36 lines

  1. External;
  2.  
  3. {$I "include:utils/stringlib.i"}
  4. {$I "include:exec/memory.i"}
  5.  
  6. type
  7.     Str_List = record
  8.         pos  : integer;
  9.         next : ^Str_List;
  10.     end;
  11.  
  12.     Str_ListPtr = ^Str_List;
  13.  
  14. function Str_C_Pos(s : string;c : char) : Str_listPtr;
  15.  
  16. var
  17.     debut,cour,nouv : Str_ListPtr;
  18.     i : integer;
  19.  
  20. begin
  21.     debut := nil;
  22.     for i := 0 to (strlen(s)-1) do
  23.         if s[i] = c then
  24.         begin
  25.             nouv := allocmem(8,MEMF_PUBLIC);
  26.             nouv^.pos := i+1;
  27.             nouv^.next := nil;
  28.             if debut = nil then
  29.                 debut := nouv
  30.             else
  31.                 cour^.next := nouv;
  32.             cour := nouv;
  33.         end;
  34.     Str_C_Pos := debut;
  35. end;
  36.